Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the time difference of create time and post time #240

Merged
merged 3 commits into from
Nov 13, 2023

Conversation

bhuvana-talend
Copy link
Contributor

Description of change

https://jira.talendforge.org/browse/TDL-20939
The change is to add more logging to decide on further steps to a discrepancy in bookmark test that occurs occassionally in stream contacts.
Log the time difference between the post message and the create time when a record is created to decide if we want to have a lookback window.

Manual QA steps

Risks

Rollback steps

  • revert this branch

tests/client.py Outdated
Comment on lines 826 to 828
#Get the current time in seconds
date= datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)
seconds =(date.total_seconds())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#Get the current time in seconds
date= datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)
seconds =(date.total_seconds())
# Get the current time in seconds
date = datetime.datetime.utcnow()
seconds = datetime.datetime.timestamp(date)

This would only give you precision to the second. We probably want to go to millisecond or microsecond precision as this suggestion would do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the time to milliseconds as suggested

tests/client.py Show resolved Hide resolved
Comment on lines 73 to 86
time_diff =0
for _ in range(self.times):
record = self.test_client.create(stream)
self.expected_records[stream] += record
if stream in 'contacts':
if self.test_client.time_difference < self.minimum:
self.minimum = self.test_client.time_difference
if self.test_client.time_difference > self.maximum:
self.maximum = self.test_client.time_difference
time_diff += self.test_client.time_difference

if stream in 'contacts':
self.avg = time_diff/5
self.test_client.record_create_times[stream] = time_diff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is necessary to change the test to create more data.

It would be better to put all the data into your record_create_times in the client itself so that any test that creates this data by calling the client will have this data recorded.

Then once the test is finished you can use a tearDown method to analyze the data from the setup. We could add this teardown to any test that uses the contacts stream to get data from multiple tests instead of just this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the code to record the times to client. And, added teardown method to print the result at the end.

@bhuvana-talend bhuvana-talend merged commit 85f3de9 into master Nov 13, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants